{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 决策边界"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 决策边界的推导\n",
    "> 当我们p>0.5时，预测分类为1；小于0.5时，预测分类为0，这也是逻辑回归的核心要义\n",
    "\n",
    "![决策边界的推导1](images/决策边界的推导1.png)\n",
    "## 决策边界的含义\n",
    "![决策边界的含义](images/决策边界的含义.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "from sklearn import datasets\n",
    "iris = datasets.load_iris()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = iris.data\n",
    "y = iris.target"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[5.1, 3.5, 1.4, 0.2],\n",
       "       [4.9, 3. , 1.4, 0.2],\n",
       "       [4.7, 3.2, 1.3, 0.2],\n",
       "       [4.6, 3.1, 1.5, 0.2],\n",
       "       [5. , 3.6, 1.4, 0.2]])"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X[:5, :]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(150,)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0, 0, 0, 0, 0])"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y[:5]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = X[y<2, :2] # 选取X中对应地y小于2的部分的前两列(即前两个特征)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "y = y[y<2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100, 2)"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(100,)"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD5CAYAAAA3Os7hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAYiUlEQVR4nO3dfYxcV3kG8OfxrAssAUciqxLF9owqEH8EEhKvQlAQApxWUDtGFSC5WkSNirbdJSVRkVCDJSuxZFVVJXAhWkdDUBXwtgTCh5wEaBNDpEQtRmOT2A2mUoq8iSE0S1Ic6ALFm7d/3Lv27ux8nblz5p5z5vlJo525c339njveV9f3PvcMzQwiIhK/DWUXICIig6GGLiKSCDV0EZFEqKGLiCRCDV1EJBFq6CIiiRjrdUWSFQANAD8xs51N7+0B8PcAfpIvutPM7u60vcsuu8xqtZpTsSIio+748eM/N7OJVu/13NAB3ALgNIBXt3n/XjO7udeN1Wo1NBoNh79eRERILrR7r6dTLiQ3A9gBoONRt4iIlKfXc+gHAXwCwEsd1nkfyZMk7yO5pdUKJKdJNk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NDD+CL//Fa8B8AJM/vvFu95+fxGsqGb2W1mttnMasj+S/QdM/vg6nWazmftQnbxNBokX0nyVSvPAfwRgP9oWu0IgA/lV9yvB3DOzJ4dcqnOehkbydeSZP78OmT/1p8fdq39MLOfAXiG5BvyRdsB/LBptSg/O6C38cX8+a3yp2h9ugXw9PmNesplDZL7ATTM7AiAj5HcBeA8gBcA7Cmztj78PoCv578TYwD+ycy+TfIvAcDM7gLwTQB/DOApAEsAPlxSra56Gdv7AcyQPA/g1wB2W1y3Rf8VgPn8v+0/BvDhRD67Fd3GF/XnR3IcwB8C+ItVy7x/frr1X0QkESN5ykVEJEVq6CIiiVBDFxFJhBq6iEgi1NBFRBKhhi4ikgg1dBGRRPw/zPFO/dBMHDQAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.axis('on')\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1], color='red') # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1], color='green')\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1.使用我们自己实现地逻辑回归算法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "from playML.model_selection import train_test_split\n",
    "X_train, X_test, y_train, y_test = train_test_split(X, y, seed=666) # 默认按照测试集:训练集=8:2来划分地"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "LogisticRegression()"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 训练逻辑回归的模型\n",
    "from playML.LogisticRegression import LogisticRegression\n",
    "log_reg = LogisticRegression()\n",
    "log_reg.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.score(X_test, y_test) # 预测正确率到了100%"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([0.92972035, 0.98664939, 0.14852024, 0.01685947, 0.0369836 ,\n",
       "       0.0186637 , 0.04936918, 0.99669244, 0.97993941, 0.74524655,\n",
       "       0.04473194, 0.00339285, 0.26131273, 0.0369836 , 0.84192923,\n",
       "       0.79892262, 0.82890209, 0.32358166, 0.06535323, 0.20735334])"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.predict_proba(X_test) # 每个元素对应的发生时间1的概率性,根据是否大于0.5决定是1还是0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0])"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_test"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0])"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.predict(X_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 3.01796521, -5.04447145])"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.coef_ # 系数θ向量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "-0.6937719272911228"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "log_reg.intercept_ # 截距"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 2.绘制出我们上面说地决策边界\n",
    "![决策边界的含义](images/决策边界的含义.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "def x2(x1):\n",
    "    return (-log_reg.intercept_- log_reg.coef_[0] * x1) / log_reg.coef_[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [],
   "source": [
    "x1_plot = np.linspace(4, 8, 1000)\n",
    "x2_plot = x2(x1_plot)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3deXwU9f3H8deHhCscQS45QhKQGxEFpCIqKHghYFutRbEqrU1LtJ7Uo7QqVFqt9wUW9Ye2UGu1rYWAByAgHqCgIpJwBAjhvgk3JJvP749dFEOS3WR3dmZ3P8/HYx/Jzs7x2SF8Mpl5z3dFVTHGGBP7arhdgDHGmMiwhm6MMXHCGroxxsQJa+jGGBMnrKEbY0ycSHZrw02bNtXMzEy3Nm+MMTFpyZIlO1W1WXmvudbQMzMzWbx4sVubN8aYmCQi6yt6zU65GGNMnLCGbowxccIaujHGxAlr6MYYEyesoRtjTJywhm6MMXHC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E/Od8SkTZRqAlAgfdFZImIZJXz+rf7K2BjYJrbdQH0FZGlIvKOiHSLQk3tgB3A5MCps5dFpF6ZedzYX6HUBdHfX2UNB14vZ7pbP2PHVVQXRHmfqeom4HGgENgCFKnq+2Vmi2gP82xDF5EhwHZVXVLZbOVMczSHGWJd04FMVT0DmM13v4Gd1k9Ve+L/s/cWEbmgzOtR318Bwer6Av/4FD2A54C3o1BTMtATmKiqZwEHgfvKzOPG/gqlLjf217cCp4GGAW+W93I506KSjQ5SV9T3mYicgv8IvC3QCqgnIteXna2cRau9vzzb0IF+wDARKQD+CVwkIlPKzLMRaAMQ+JMmFdjtdl2quktVjwaevgT0crim49vdHPi6Hf85xD5lZvl2fwWkcfKfgFGvS1X3qeqBwPczgZoi0tThsjYCG1V1UeD5W/gbadl5or2/gtbl0v460eXAF6q6rZzXXPkZC6iwLpf22SBgnaruUNVi4D/AuWXmiWgP82xDV9X7VTVNVTPx/xn1gaqW/e02Dbgx8P3VgXkcPRoIpa4y5wyH4b946igRqSciDY5/D1wCfFNmtmnADYEkwjn4/wTc4nZdItLi+HlDEemD/+dyl5N1qepWYIOIdApMGgjklpkt6vsrlLrc2F9lXEvFpzWivs9CqculfVYInCMiKYFtD+TkXhDRHhYLKZfvEZFxwGJVnYb/wtHfRSQf/2+14R6p6zYRGQaUBOq6KQolnAr8N/Azmwz8Q1XfFZFfA6jqi8BMYDCQDxwCRnqkrquBUSJSAhwGhjv9izngN8DUwJ/qa4GRHthfodTl1v5CRFKAi4FfnTDN9X0WQl1R32equkhE3sJ/uqcE+BKY5GQPs1v/jTEmTnj2lIsxxpiqsYZujDFxwhq6McbECWvoxhgTJ6yhG2NMnLCGbowxccIaujHGxIn/B5QSCAhgRl+/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X[y==0, 0], X[y==0, 1], color='red') # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1], color='green') \n",
    "plt.plot(x1_plot, x2_plot) # 把逻辑回归的边界画出来\n",
    "plt.show() # 对全量数据集绘图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXQAAAD4CAYAAAD8Zh1EAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3dd3hUVf7H8fdJqKGEFmpIQu+gEEAsWMAGiCK6sotdF8u6tt8uRSwIYl3broVFXRclroUEBVSwIaIibkBJoQYIvQcSIKSf3x8TXIwJCcnM3DuTz+t58mTm3svMl2v85HDnnO811lpERCTwhThdgIiIeIcCXUQkSCjQRUSChAJdRCRIKNBFRIJEDafeuFmzZjYmJsaptxcRCUgrVqzYb62NKG2fY4EeExNDYmKiU28vIhKQjDFbytqnSy4iIkFCgS4iEiQU6CIiQUKBLiISJBToIiJBQoEuIhIkFOgiIkFCgS4i4if5hUW88nUaq7Yd8snrO7awSESkOknZkcmE+CRSd2Zx+7kF9GnbyOvvoUAXEfGhnPxC/vHVBmYs2UTjsFq8OrYvl/Zq5ZP3UqCLiPhIYnoG4+OT2LTvKFf3i+TB4d0JD6vps/dToIuIeNmR3AKeWbiWt37YQuvwurx18wAGdy61n5ZXKdBFRLxoyfp9PJCQzM7MY9wwKIa/XtyFerX9E7UKdBERLziUnce0BWuIX7mdDhH1+OC2QcTGNPFrDQp0EZEq+jR5Fw99lMrB7DzuOr8jd13QkTo1Q/1ehwJdRKSS9mbl8PBHqSxM3U3PNg2ZdXN/erQOd6weBbqIyCmy1vLBiu08tmA1OQVFTLikK388px01Qp1dq1nhQDfGhAKJw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XE+erhN9T9mUNv5+zitTl0DnbCpxhjAkrfu8h/DYLvJphgTDL5VeMMVOBRGvtPDwfHL1tjEnD81ttjEvqutsYMxIoKK7rRj+U0AKYW/wzWwN4x1q70BhzO4C1dgbwCTAMSAOygZtcUtdVwB3GmALgGDDG17+Yi/0ZiCv+p/om4CYXnK+K1OXU+cIYEwZcCNx2wjbHz1kF6vL7ObPWLjfGzMFzuacA+AmY6csM09J/EZEg4dpLLiIicmoU6CIiQUKBLiISJBToIiJBQoEuIhIkFOgiIkFCgS4iEiT+H+/HiJx9eFV/AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(X_test[y_test==0, 0], X_test[y_test==0, 1], color='red') # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(X_test[y_test==1, 0], X_test[y_test==1, 1], color='green') \n",
    "plt.plot(x1_plot, x2_plot) # 把逻辑回归的边界画出来\n",
    "plt.show() # 对测试数据集绘图"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 绘制全部点的时的边界"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [],
   "source": [
    "def plot_decision_boundary(model, axis):\n",
    "    \"\"\"\n",
    "    根据模型绘制决策边界\n",
    "    \"\"\"\n",
    "    x0, x1 = np.meshgrid(\n",
    "        np.linspace(axis[0], axis[1], int((axis[1]-axis[0])*100)).reshape(-1, 1),\n",
    "        np.linspace(axis[2], axis[3], int((axis[3]-axis[2])*100)).reshape(-1, 1),\n",
    "    )\n",
    "    X_new = np.c_[x0.ravel(), x1.ravel()]\n",
    "\n",
    "    y_predict = model.predict(X_new)\n",
    "    zz = y_predict.reshape(x0.shape)\n",
    "\n",
    "    from matplotlib.colors import ListedColormap\n",
    "    custom_cmap = ListedColormap(['#EF9A9A','#FFF59D','#90CAF9'])\n",
    "    \n",
    "    plt.contourf(x0, x1, zz, linewidth=5, cmap=custom_cmap)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:17: UserWarning: The following kwargs were not used by contour: 'linewidth'\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAcTElEQVR4nO3dcYxd5Xnn8e/D2Gu7ZIx3QgiW7dSKIKhaNuCA3EZeJSzJrhqCTCWo8IosEKXytmpIaFKhUktkhcQf2ZWqpGGVyAnL2kk2TWPSroNItUQJm8A2VMZQCHETubsE7BgMOOAxHbyM/ewf914zc+beue+9855z3nPe30eymDn3+NznHpvHZ977O881d0dERNrvrLoLEBGRaqjhi4hkQg1fRCQTavgiIplQwxcRyYQavohIJoIbvplNmNnjZnZ/n8duNrMXzeyJ7q/fi1umiIgs1bIR9v0kcABYPeDxb7r7x5dekoiIlCHoCt/M1gMfBr5SbjkiIlKW0Cv8zwG3AZOL7HOtmb0P+DnwR+7+XHEHM9sObAc4e8WKyy48//wRyxURydsTv/jFS+7+tnF+79CGb2ZXA0fd/TEzu2LAbt8BvuHuJ83s94FdwJXFndx9J7ATYNPGjf6DHTvGqVlEJFv/fPv2X4z7e0OWdLYAW83sGeAvgCvN7Gtzd3D3l939ZPfbLwOXjVuQiIiUY2jDd/fb3X29u28EtgHfd/ePzN3HzNbO+XYrnTd3RUQkIaOkdOYxszuBfe6+F/iEmW0FZoFjwM1xyhMRkVhGavju/hDwUPfrO+Zsvx24PWZhImV7YHoVXzg2y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ffd/SOF3fYCN3W/vq67TxL/yobUX1jz20rnzd0kmNnZZjbZ+xr4t0BxQule4MZuYuG3gFfd/UjFpS4QUrslPNbD3Z8HnjOz3mTDDwA/LeyW5LmHsPpTPv9z/DsGL4cke/7nGFj/OOe/qpTOPGZ2J7DP3ffSeVPoq2Z2kM6V/bY6ahpFof5PmNlWYJZO/TfXWVvB24G/6v6dWAb8d3f/GzP7fTgzGuMB4CrgIPBPwEdrqrUopPZxx3pU5Rbg690fy/8P8NGGnPueYfUnff7N7NeAfwP8hznbGnP+A+of+fxrtIKISCZ0p62ISCbU8EVEMqGGLyKSCTV8EZFMqOGLiGRCDV9EJBNq+CIimfj/VaZNnfFKP0AAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "plot_decision_boundary(log_reg, axis=[4, 7.5, 1.5, 4.5])\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## kNN的决策边界"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "                     metric_params=None, n_jobs=None, n_neighbors=5, p=2,\n",
       "                     weights='uniform')"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from sklearn.neighbors import KNeighborsClassifier\n",
    "knn_clf = KNeighborsClassifier()\n",
    "knn_clf.fit(X_train, y_train)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1.0"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf.score(X_test, y_test) # 正确率还是100%"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:17: UserWarning: The following kwargs were not used by contour: 'linewidth'\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAc2UlEQVR4nO3df4xdZ33n8fc3M157GsaxnB/Ysk0tFIgq0iQmllvkClJCV02InEoJIquwSRDIBUFISlHU1JKRIuUPdqUuaZBAJtmsDZSlOLRrIlM1CLKQbAlynBATDMjdhdhmEic2scfpxM2Mv/vHvXcyc+beuc+99znnPOeez0sa5c65x+d+77HznWee8znPNXdHRESG3zllFyAiIsVQwxcRqQk1fBGRmlDDFxGpCTV8EZGaUMMXEamJ4IZvZiNm9rSZPdLmudvM7CUze6b59dG4ZYqIyKBGe9j3DuAgsLzD899w908OXpKIiOQhaIRvZmuB9wMP5FuOiIjkJXSE/3ngLmB8kX1uMLN3A78E/sLdD2d3MLOtwFaAc5cuvfJtq1b1WK6ISMPxsfPLLqEUh3++/2V3v7CfP9u14ZvZdcAxd3/KzK7qsNu3ga+7+xkz+xiwE3hvdid33wHsANiwfr1/f9u2fmoWkZpacfMI9z33obLLKNWdm5b+ut8/GzLC3wxsMbNrgWXAcjP7qrvPnnV3Pz5n/y8Dn+u3IBGRrNlG/1zZlVRb14bv7ncDdwM0R/ifmdvsm9tXu/tE89stNC7uiogMbOcVt6rRR9JLSmceM7sH2Ofue4BPmdkWYBo4AdwWp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alcv6BrvX3fP7zHuFvBraY2a+A/wm818y+mtnnCLAOwMxGgfNIZ3XOrvW7+3F3P9P89svAlcWWuDh3/03zv8dozAFuyuwye/6b1tJYBK903WpPfFmPI8ARd3+y+f1uGg00u0+S556A+hM//y3XAPvd/cU2z6V8/ls61t/P+c+14bv73e6+1t3X0/i15Hvu/qHMbnuAW5uPb2zuk8RP2ZD6M3N+W2hc3E2CmZ1rZuOtx8B/BLIrlO4BbmkmFv4QOOnuEwWXukBI7Zbwsh7u/gJw2MxaKxteDfwss1uS5x7C6k/5/M/xn+g8HZLs+Z+jY/39nP+iUjrzmNk9wD5330PjotBXzOwQjZH9TWXU1ItM/Z8ysy3ANI36byuztow3A//Q/DcxCvydu/+TmX0MZpfG2AtcCxwC/g34cEm1ZoXU3u+yHkW5Hfha89fy/wt8uCLnvqVb/UmffzP7HeBPgD+fs60y5z+g/p7Pv5ZWEBGpCd1pKyJSE2r4IiI1oYYvIlITavgiIjWhhi8iUhNq+CIiNaGGLyJSE/8fQ9/C+blnIagAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 虽然kNN的决策边界并不能用数学方法算出来，但是只要有predict算法，我们去足够多的点绘制，边界自然就出来了\n",
    "plot_decision_boundary(knn_clf, axis=[4, 7.5, 1.5, 4.5]) # knn的决策边界也是可以画出来地\n",
    "plt.scatter(X[y==0, 0], X[y==0, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(X[y==1, 0], X[y==1, 1])\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 使用kNN对鸢尾花数据的全量进行分析\n",
    "> X还是取前两列，方便可视化;但是y取所有，一共分0、1、2三类，下面我们看看决策边界"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "                     metric_params=None, n_jobs=None, n_neighbors=5, p=2,\n",
       "                     weights='uniform')"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf_all = KNeighborsClassifier()\n",
    "knn_clf_all.fit(iris.data[:, :2], iris.target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:17: UserWarning: The following kwargs were not used by contour: 'linewidth'\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3df5BddZnn8ffT3SFpkk4iP0ICAcMUjD9ADZLKMGTGFXQtSRigBFa2wAHLkRlr1DgzO7PLxAKkZC3LrZnJ6I5TUXdFcR0lMoSRYDGOuCosUAkgJrbOZIyQkE7CD0O6Q4J0+tk/7r2d7tP39vnee849P/p8XlVd9D3n3HOee+g8/e3vec5zzN0REZGZryfvAEREJBtK+CIiFaGELyJSEUr4IiIVoYQvIlIRSvgiIhURnPDNrNfMnjCzbzdZd4OZPWdmT9a//iDdMEVEJKm+NrZdCwwC81us/4a7fzh5SCIi0g1BI3wzWwqsAb7Y3XBERKRbQkf4fwP8BTAwzTZXmtnbgH8F/sTdd0U3MLMbgRsB5s6eff7Zixe3Ga6IJPVC/4l5hyAJ7PrZ48+7+8mdvDc24ZvZpcB+d99qZm9vsdk/AV9391fM7I+AO4CLoxu5+wZgA8B5y5b5g+vWdRKziHRg4bW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OpuactnNnVlU6k5jZbcAWd7+X2sWor5rZDmq/na7JI6ZmInF+1MwuA0apxXlDDiGdAvxj/WexD/g/7v4dM/sjGG91sRlYDewAXgbeX9A4O23JkaaPAF+r/3n/C+D9BTyXIXEW4VxiZscD/xH4wwnLCnc+A+LM/Xy6+6NmtpHa9NIo8ASwIWnuVGsFEZGK0J22IiIVoYQvIlIRSvgiIhWhhC8iUhFK+CIiFaGELyJSEUr4IiIV8f8BbAd4/YqxRm0AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 虽然kNN的决策边界并不能用数学方法算出来，但是只要有predict算法，我们去足够多的点绘制，边界自然就出来了\n",
    "plot_decision_boundary(knn_clf_all, axis=[4, 8, 1.5, 4.5]) # knn的决策边界也是可以画出来地\n",
    "plt.scatter(iris.data[iris.target==0, 0], iris.data[iris.target==0, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(iris.data[iris.target==1, 0], iris.data[iris.target==1, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(iris.data[iris.target==2, 0], iris.data[iris.target==2, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "KNeighborsClassifier(algorithm='auto', leaf_size=30, metric='minkowski',\n",
       "                     metric_params=None, n_jobs=None, n_neighbors=50, p=2,\n",
       "                     weights='uniform')"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "knn_clf_all = KNeighborsClassifier(n_neighbors=50) # neignbours变大，决策边界会变得更规则，即过拟合程度降低\n",
    "knn_clf_all.fit(iris.data[:, :2], iris.target)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "D:\\ProgramData\\Anaconda3\\lib\\site-packages\\ipykernel_launcher.py:17: UserWarning: The following kwargs were not used by contour: 'linewidth'\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXwAAAD8CAYAAAB0IB+mAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAgAElEQVR4nO3df5CUhZ3n8fd3phEQBtEoDooG9zRGpVQiRYxcconmUgEssaJu3DLZmMouu6nVYLJXqXNJqbHipXJ3tRtWq5KguYvGXKKiKyaAZbxoGeXUAkWDGXVJ/AEygIoDwwhqT3/vj+4eZprueZ7ufvrp5+nn86qacuZ5nnn624/Dd555+tPfx9wdERHpfF3tLkBEROKhhi8ikhFq+CIiGaGGLyKSEWr4IiIZoYYvIpIRoRu+mXWb2bNm9psq6640szfNbFPp42+iLVNERJqVq2PbZUAfMK3G+rvc/armSxIRkVYIdYZvZrOAxcBtrS1HRERaJewZ/g+BbwM942xziZl9CngZ+Ka7b63cwMyWAksBpkyceM4pvb11liuSbm9P/lC7S5CU2/riM2+5+zGNfG9gwzezC4Fd7r7RzD5dY7NfA7909/fM7O+B24HzKzdy95XASoC5s2f7I8uXN1KzSGrdfvZX2l2CpNw18ye+1uj3hrmkswC4yMxeBX4FnG9md47ewN3fdvf3Sl/eCpzTaEEinUrNXtotsOG7+7XuPsvdZwOXA79z9y+N3sbMZo768iKKL+6KSImavSRBPSmdMczsRmCDuz8AfMPMLgLywG7gymjKExGRqNTV8N39UeDR0ufXjVp+LXBtlIWJjLZ2cDI37+5hR76b3twwVx81yKKe/e0uSyRVGj7DF4nL2sHJ3PjmERzw4hXI/nyOG988AkBNX6QOGq0giXfz7p6RZl92wLu4efd4KeHk0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A6U+XI4h/Omdgne7+tru/V/ryVuCceEscqWN76b+7KF57nF+xycjxLJnFoX8KtlxQnQkYybEN2ObuT5W+XkWxsVZu0+5jGVhnAo7laAuBZ9x9Z5V1STieZTXrTMjx/Czwiru/6e4fAPcB51VsU3fvbGnDd/dr3X2Wu8+m+OfT79y98rfUA8BXSp9fWtom1t/6YeqsuNZ4EcUXd2NlZlPMrKf8OfA5Dp04+gDw16VExLkU/xTsT1qd1uaRHO6+A9hqZqeWFl0A/LFis7YfyzB1tvtYVvgral8mafvxHKVmnQk5nq8D55rZ4aVaLuDQnlN374wrpTOGmd0IbHD3Byi+GPVzM9tC8bfT5e2oqZqKOr9hZhcBeYp1XtmGko4F/q30s5gD/o+7P2hmfw8joy7WAouALcC7wFcTWmejIzmidDXwi9Kf938GvprAYxmmziQcS8zscOA/A383alnijmeIOtt+PN39KTNbRfHyUh54FljZbO/UaAURkYzQO21FRDJCDV9EJCPU8EVEMkINX0QkI9TwRUQyQg1fRCQj1PBFRDLi/wOePY5v1mEuUwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "# 虽然kNN的决策边界并不能用数学方法算出来，但是只要有predict算法，我们去足够多的点绘制，边界自然就出来了\n",
    "plot_decision_boundary(knn_clf_all, axis=[4, 8, 1.5, 4.5]) # knn的决策边界也是可以画出来地\n",
    "plt.scatter(iris.data[iris.target==0, 0], iris.data[iris.target==0, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(iris.data[iris.target==1, 0], iris.data[iris.target==1, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.scatter(iris.data[iris.target==2, 0], iris.data[iris.target==2, 1]) # 用前两列即两个特征作为坐标轴的横纵坐标\n",
    "plt.show()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
